package logs

import (
	"github.com/kataras/golog"
	"cn.pinming/gencode/core"
)

//
func Logger() *golog.Logger {
	return core.GetApp().Logger();
}

// Log prints a leveled log message to the output.
// This method can be used to use custom log levels if needed.
// It adds a new line in the end.
func  Log(level golog.Level, v ...interface{}) {
	core.Logger().Log(level,v...)
}

// Logf prints a leveled log message to the output.
// This method can be used to use custom log levels if needed.
// It adds a new line in the end.
func  Logf(level golog.Level, format string, args ...interface{}) {
	core.GetApp().Logger().Logf(level,format,args...)
}

// Fatal `os.Exit(1)` exit no matter the level of the logger.
// If the logger's level is fatal, error, warn, info or debug
// then it will print the log message too.
func Fatal(v ...interface{}) {
	core.Logger().Fatal(v...)
}

// Fatalf will `os.Exit(1)` no matter the level of the logger.
// If the logger's level is fatal, error, warn, info or debug
// then it will print the log message too.
func   Fatalf(format string, args ...interface{}) {
	core.Logger().Fatalf(format,args...)
}

// Error will print only when logger's Level is error, warn, info or debug.
func Error(v ...interface{}) {
	core.Logger().Error(v...)
}

// Errorf will print only when logger's Level is error, warn, info or debug.
func  Errorf(format string, args ...interface{}) {
	core.Logger().Errorf(format,args...)
}

// Warn will print when logger's Level is warn, info or debug.
func   Warn(v ...interface{}) {
	core.Logger().Warn(v...)
}

// Warnf will print when logger's Level is warn, info or debug.
func Warnf(format string, args ...interface{}) {
	core.Logger().Warnf(format,args...)
}

// Info will print when logger's Level is info or debug.
func   Info(v ...interface{}) {
	core.Logger().Info(v...)
}

// Infof will print when logger's Level is info or debug.
func  Infof(format string, args ...interface{}) {
	core.Logger().Infof(format,args...)
}

// Debug will print when logger's Level is debug.
func   Debug(v ...interface{}) {
	core.Logger().Debug(v...)
}

// Debugf will print when logger's Level is debug.
func   Debugf(format string, args ...interface{}) {
	core.Logger().Debugf(format,args...)
}
